// 订单相关操作
import request,{Method} from '@/plugins/api.js'

// 根据订单sn获取该订单的交易sn
export function getTradeSnByOrderSn(sn){
  return request({
      url : `/order/trade/getTradeSnByOrderSn/${sn}`,
      method: Method.GET,
  })
}

// 用户取消订单
export function userCancelOrder (params) {
    return request({
      url: '/order/order/userCancelOrder',
      method: Method.POST,
      data: params
    });
}

// 获取用户中心中的订单分页数据
export function getBuyerOrderByPage (params) {
    return request({
      url: '/order/order/getBuyerOrderByPage',
      method: Method.POST,
      data: params
    });
}

// 获取订单详情
export function getOrderDetail (params) {
    return request({
      url: '/order/order/getOrderDetail',
      method: Method.POST,
      data: params
    });
}

// 用户确认收货
export function userReceiveOrder (params) {
    return request({
      url: '/order/order/userReceiveOrder',
      method: Method.POST,
      data: params
    });
}

// 获取当前投诉订单项的id
export function getOrderComplaintItem(itemId){
  return request({
    url : `/order/ordercomplaint/getOrderComplaintItem/${itemId}`,
    method: Method.GET,
  })
}

// 获取当前投诉订单项的id
export function getOrderItemById(id){
  return request({
    url : `/order/orderitem/getOrderItemById/${id}`,
    method: Method.GET,
  })
}

// 会员商品进行评价
export function addMemberEvaluation (params) {
  return request({
    url: '/member/membermvaluation/addMemberEvaluation',
    method: Method.POST,
    data: params
  });
}
